var a = getApp();

Component({
    properties: {
        datas: {
            type: null
        },
        component_id: {
            type: null
        },
        page_id: {
            type: null
        },
        index: {
            type: null
        },
        U_tabcontrol: {
            type: null
        },
        bottomShowBol: {
            type: null
        },
        bottomShowBolIndex: {
            type: null
        },
        isLast: {
            type: null
        }
    },
    data: {
        info: [],
        showShare: !1,
        options: [ {
            name: "视频",
            icon: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images%2FtaskPackage%2Fshipin.png",
            router: "VideoList"
        }, {
            name: "文章",
            icon: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images%2FtaskPackage%2Fwenzhang.png",
            router: "notice"
        } ],
        taskDay: "",
        taskID: "",
        usable_name: "",
        page: 1,
        isLoadMore: !0,
        total_page: 0
    },
    lifetimes: {
        attached: function() {
            this.getData();
        },
        moved: function() {},
        detached: function() {}
    },
    observers: {
        datas: function() {
            this.getData();
        },
        bottomShowBol: function(a) {
            a && this.data.bottomShowBolIndex == this.data.index && this.data.isLoadMore && this.getMoreData();
        }
    },
    methods: {
        showShareCancel: function() {
            this.setData({
                showShare: !1
            });
        },
        makeTask: function(a) {
            var t = a.currentTarget.dataset.item;
            this.data.taskID = t.id, this.data.showShare = !0;
            var e = new Date(), o = e.getFullYear(), s = e.getMonth() + 1, i = e.getDate();
            this.data.taskDay = "".concat(o, "-").concat(s, "-").concat(i), this.setData({
                taskID: this.data.taskID,
                showShare: this.data.showShare,
                taskDay: this.data.taskDay
            });
        },
        shareHandle: function(a) {
            "VideoList" == a.currentTarget.dataset.item.router ? wx.navigateTo({
                url: "/packageC/video_goods/VideoList/VideoList?taskID=".concat(this.data.taskID, "&taskDay=").concat(this.data.taskDay)
            }) : wx.navigateTo({
                url: "/packageA/member/notice/notice?taskID=".concat(this.data.taskID, "&taskDay=").concat(this.data.taskDay)
            });
        },
        getMoreData: function() {
            var t = this;
            this.data.isLoadMore = !1, this.data.page >= this.data.total_page || (this.setData({
                page: this.data.page + 1
            }), a._getNetWork({
                url: a.getNetAddresss("plugin.task-package.frontend.daily.decorate-list"),
                data: {
                    page: this.data.page
                },
                success: function(a) {
                    var e = a.data;
                    1 == e.result && (t.setData({
                        info: t.data.info.concat(e.data.data),
                        total_page: e.data.last_page,
                        isLoadMore: !0
                    }), t.data.page >= t.data.total_page && t.setData({
                        isLoadMore: !1
                    }));
                },
                fail: function(a) {
                    console.log(a);
                }
            }));
        },
        getData: function() {
            var t = this;
            a._getNetWork({
                url: a.getNetAddresss("plugin.task-package.frontend.daily.decorate-list"),
                success: function(a) {
                    var e = a.data;
                    1 == e.result && (t.setData({
                        info: e.data.data,
                        usable_name: e.data.usable_name,
                        total_page: e.data.last_page,
                        isLoadMore: !0
                    }), t.data.page >= t.data.total_page && t.setData({
                        isLoadMore: !1
                    }));
                },
                fail: function(a) {
                    console.log(a);
                }
            });
        }
    }
});